﻿using System.Collections.Generic;
using System.Net;

namespace AllInOnePluginBL.Helpers
{
    /// <summary>
    /// Summary description for VideoResult
    /// </summary>
    public class VideoResult
    {
        public string Link { get; set; }
        public string MovieName { get; set; }
        public bool IsValid { get; set; }
        public VideoDetails VideoDetails { get; set; }
        public List<Cookie> Cookies { get; set; } 

        public VideoResult(string link, bool isValid)
        {
            Cookies = new List<Cookie>();
            this.Link = Utils.LoopDecodeUrl(link);
            this.IsValid = isValid;

            if (isValid)
            {
                var start = this.Link.LastIndexOf("/");
                if (start != -1)
                    this.MovieName = this.Link.Substring(start + 1);
            }
        }

        public VideoResult(string link, string movieName, bool isValid)
        {
            Cookies = new List<Cookie>();
            this.Link = Utils.LoopDecodeUrl(link);
            this.IsValid = isValid;
            this.MovieName = movieName;
        }

        public VideoResult(string link, string movieName, bool isValid, List<Cookie> cookies)
        {
            this.Link = Utils.LoopDecodeUrl(link);
            this.IsValid = isValid;
            this.MovieName = movieName;
            this.Cookies = cookies;
        }
    }
}